#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
#include<string.h>

int main() {
    int m, n;
    char arr[100];
    scanf("%d %d", &n, &m);
    scanf("%s", arr);
    int sz = strlen(arr);
    while (m--)
    {
        int l;
        int r;
        char c1, c2;
        scanf("%d %d %c %c", &l, &r, &c1, &c2);
        int i = 0;
        for (i = l - 1; i < r; i++)
        {
            if (arr[i] == c1)
            {
                arr[i] = c2;
            }
        }
    }
    printf("%s", arr);
    return 0;
}